package br.com.dreamsource.mobile.worders.forms.core;

/**
 *
 * @author Elizeu Nogueira da Rosa Jr.
 * @version 0.1
 * @date 21.05.2007
 *
 */

public class Consts {
    
    public static final int UPDATE_TYPE_INSERT = 1;
    public static final int UPDATE_TYPE_UPDATE = 2;
    public static final int UPDATE_TYPE_DELETE = 3;
    
    public static final String DATABASE_NAME = "worders";
    public static final String DATABASE_CONNETION_STRING = "jdbc:mesqldb:worders";
    
    public static final String DROP_USER = "DROP USER ?";
    public static final String CREATE_USER = "CREATE USER ? PASSWORD ? admin";

    public static final String DROP_PRICTABLE_TBL = "DROP TABLE priceTable";
    public static final String CREATE_PRICETABLE_TBL = 
            "CREATE TABLE priceTable (" +
            "   id int identity, " +
            "   name varchar(20) not null, " +
            "   percent float not null," +
            "   primary key(id)" +
            ")";
    
    public static final String PRICETABLE_ID = "id";
    public static final String PRICETABLE_NAME = "name";
    public static final String PRICETABLE_PERCENT = "percent";
    
    public static final String PRICETABLE_SELECT_BY_EDIT = "SELECT * FROM pricetable";
    
    public static final String DROP_CUSTOMER_TBL = "DROP TABLE customer";
    public static final String CREATE_CUSTOMER_TBL = 
            "CREATE TABLE customer (" +
            "   id int identity," +
            "   remoteId int," +
            "   priceTableId  int," +
            "   dtRecord date," +
            "   name varchar(80) not null," +
            "   cpf varchar(11)," +
            "   cnpj varchar(14)," +
            "   phone varchar(10) not null," +
            "   fax varchar(10)," +
            "   contact varchar(80) not null," +
            "   mail varchar(80)," +
            "   zipCode varchar(8) not null," +
            "   credit float," +
            "   recordState int not null," +
            "   primary key(id)," +
            "   foreign key(priceTableId) references priceTable(id)" +
            ")";
    
    public static final String CUSTOMER_ID = "id"; 
    public static final String CUSTOMER_REMOTEID = "remoteid"; 
    public static final String CUSTOMER_PRICETABLEID = "pricetableid"; 
    public static final String CUSTOMER_DTRECORD = "dtrecord"; 
    public static final String CUSTOMER_NAME = "name"; 
    public static final String CUSTOMER_CPF = "cpf"; 
    public static final String CUSTOMER_CNPJ = "cnpj"; 
    public static final String CUSTOMER_PHONE = "phone"; 
    public static final String CUSTOMER_FAX = "fax"; 
    public static final String CUSTOMER_CONTACT = "contact"; 
    public static final String CUSTOMER_MAIL = "mail"; 
    public static final String CUSTOMER_ZIPCODE = "zipcode"; 
    public static final String CUSTOMER_CREDIT = "credit"; 
    public static final String CUSTOMER_RECORDSTATE = "recordstate"; 
    
    public static final String CUSTOMER_LOCATE_BY_FIELD = "SELECT id, name FROM customer";
    public static final String CUSTOMER_SELECT_BY_EDIT = 
            "SELECT priceTableId, name, cpf, cnpj, phone, fax, contact, mail, " +
            "zipCode, credit FROM customer";
    
    public static final String CUSTOMER_INSERT = 
            "INSERT INTO customer (remoteId, priceTableId, dtRecord, name, cpf, cnpj, phone, fax, " +
            "contact, mail, zipCode, credit, recordState) VALUES (0, ?, CURDATE(), ?, ?, ?, ?, ?, ?, ?, ?, ?, 0)";
    
    public static final String CUSTOMER_UPDATE = 
            "UPDATE customer set priceTableId = ?, name = ?, cpf = ?, cnpj = ?, phone = ?, fax = ?, " +
            "contact = ?, mail = ?, zipCode = ?, credit = ? where id = ?";
    
    public static final String CUSTOMER_DELETE = 
            "DELETE FROM customer where id = ?";
    
    
}




            
